<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<script type="text/javascript" src="../src/Base.js"></script>
<script type="text/javascript" src="../src/DataStructure.js"></script>
<script>
var last_time;
function test(N)
{
	var list = new GFList;
	var ar = new Array();
	var tcase = new Array(N);
	var i,v;

	for(i=0;i<N;i++) {
		v = Math.round(Math.random()*1000000);
		tcase[i] = v;
	}

	start_timer();
	for(i=0;i<N;i++) {
		v = tcase[i];
		switch(v%2) {
		case 0: list.push_head(v); break;
		case 1: list.push_tail(v); break;
		}
	}
	end_timer('GFList');

	start_timer();
	for(i=0;i<N;i++) {
		v = tcase[i];
		switch(v%2) {
		case 0: ar.unshift(v); break;
		case 1: ar.push(v); break;
		}
	}
	end_timer('Array');
}
function gotest()
{
	var n = document.getElementById('N');
	test(parseInt(n.value));
}
</script>
</head>

<body>
<input id="N" type="text" value="10000" /><button onclick="javascript:gotest();">Test</button>
<script type="text/javascript" src="test.js"></script>
</body>
</html>
